package com.isorf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.isorf.mapper.ShoeTypeMapper;
import com.isorf.pojo.ShoeType;
import com.isorf.service.ShoeTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoeTypeServiceImpl implements ShoeTypeService {
    @Autowired
    private ShoeTypeMapper shoeTypeMapper;

    @Override
    public Boolean addShoeType(ShoeType shoeType) {
        int result = shoeTypeMapper.addShoeType(shoeType);
        return result > 0;
    }

    @Override
    public Boolean deleteShoeType(int typeId) {
        int result = shoeTypeMapper.deleteShoeType(typeId);
        return result > 0;
    }

    @Override
    public Boolean updateShoeType(ShoeType shoeType) {
        int result = shoeTypeMapper.updateShoeType(shoeType);
        return result > 0;
    }

    @Override
    public ShoeType getShoeTypeById(int typeId) {
        return shoeTypeMapper.getShoeTypeById(typeId);
    }

    @Override
    public PageInfo<ShoeType> pageList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ShoeType> list = shoeTypeMapper.getAllShoeTypes();
        return new PageInfo<>(list);
    }

    @Override
    public List<ShoeType> getAllShoeTypes() {
        return shoeTypeMapper.getAllShoeTypes();
    }
} 